#include "atomic_op_asm.h"

ENTRY_NP(_atomic_swap_32)
	mov	x4, x0
1:	ldxr	w0, [x4]
	stxr	w3, w1, [x4]
	cbnz	w3, 1b
	dmb	st
	ret
END(_atomic_swap_32)

ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32)
ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32)
STRONG_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32)
STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32)

ENTRY_NP(__sync_lock_release_4)
	stlr	wzr, [x0]
	ret
END(__sync_lock_release_4)
